package threadPractise;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class TestCallable implements Callable {
    private Integer result = 0;
    private Integer time;

    public TestCallable(Integer result, Integer time) {
        this.result = result;
        this.time = time;
    }

    public Integer call() throws Exception {
        return result << 2;
    }

    public static void main(String[] args) {
        TestCallable testCallable1 = new TestCallable(5, 1000);
        TestCallable testCallable2 = new TestCallable(10, 100);
        FutureTask futureTask1 = new FutureTask(testCallable1);
        FutureTask futureTask2 = new FutureTask(testCallable2);
        new Thread(futureTask1).start();
        new Thread(futureTask2).start();
        try {
            System.out.println(futureTask1.get());
            System.out.println(futureTask2.get());
        }catch (Exception e){

        }

    }
}
